Completed
Push — master ( e4d488...d7a2df )
by Sander
30s
created

API.notifications.getAll   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 5 1
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
7
8
/* global API */
9
API.notifications = {
10
    create: function(title, message){
11
        var opt = {
12
            type: "basic",
13
            title: title,
14
            message: message,
15
            iconUrl: "icons/icon32.png"
16
        };
17
        return API.api.notifications.create('PiCast', opt, function(id) { console.log("Last error:", chrome.runtime.lastError); });
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable chrome seems to be never declared. If this is a global, consider adding a /** global: chrome */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Unused Code introduced by
The parameter id is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
18
    },
19
    update: API.api.notifications.update,
20
    clear: API.api.notifications.clear,
21
22
    getAll: function () {
23
        if (API.promise) {
24
            return API.api.notifications.getAll(details);
0 ignored issues
show
Bug introduced by
The variable details seems to be never declared. If this is a global, consider adding a /** global: details */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
25
        }
26
        else {
27
            return new C_Promise(function () {
28
                API.api.notifications.getAll(details, (function (notifications) {
0 ignored issues
show
Bug introduced by
The variable details seems to be never declared. If this is a global, consider adding a /** global: details */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
29
                    this.call_then(notifications);
30
                }).bind(this));
31
            });
32
        }
33
    },
34
    /**
35
     * Event handlers from now on
36
     */
37
    onClosed: API.api.notifications.onClosed,
38
    onClicked: API.api.notifications.onClicked,
39
    onButtonClicked: API.api.notifications.onButtonClicked,
40
41
};